package com.pine.dao.pineframework.constants;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.pine.common.beans.enums.StringCodeBaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * <p>
 * 系统日志表-日志类型 枚举
 * </p>
 *
 * @author pine manage
 * @since 2024-08-12
 */
@AllArgsConstructor
@Getter
public enum LogTypeEnum implements StringCodeBaseEnum {
    ERROR("error", "错误日志"),
    INFO("info", "正常日志"),
    ;

    @EnumValue
    private final String code;
    private final String desc;

    public static LogTypeEnum of(String code) {
        return Arrays.stream(LogTypeEnum.values()).filter(logTypeEnum -> Objects.equals(logTypeEnum.code, code)).findAny().orElse(null);
    }
}
